<?php
//admin 全局配置
use Encore\Admin\Form;
use Encore\Admin\Admin;
use Encore\Admin\Form\Tools;
use Encore\Admin\Grid;
use Encore\Admin\Show;

Form::forget(['map', 'editor']);
Grid::init(function (Grid $grid) {
    $grid->disableActions();  //禁止行级路由
    //$grid->disablePagination(); //禁止分页
    $grid->disableCreateButton(); //禁止新增
    //$grid->disableFilter();  //禁止过滤
    $grid->disableRowSelector(); //禁止列选择
    $grid->disableColumnSelector(); //禁止行选择
    //$grid->disableTools();  //禁止工具栏
    $grid->disableExport(); //禁止导出
    $grid->enableHotKeys();//快捷键
    $grid->paginate(10)->perPages([10]);
    $grid->actions(function (Grid\Displayers\Actions $actions) {
        $actions->disableView(); //禁止行级查看路由
        $actions->disableEdit(); //禁止行级编辑路由
        $actions->disableDelete(); //禁止行级删除路由
    });
});
Form::init(function (Form $form) {
    $form->setWidth(11, 1)->tools(function (Tools $tools) {
        $tools->disableDelete();
    });
    $form->footer(function ($footer) {
        $footer->disableReset();
        $footer->disableViewCheck();
        $footer->disableEditingCheck();
        $footer->disableCreatingCheck();
    });
});
Show::init(function (Show $show) {
    $show->panel()->tools(function ($tools) {
        $tools->disableDelete();
        $tools->disableEdit();
    });
});
Admin::css('css/admin.css');
Admin::js('js/com.js');
Admin::script("LA.prefix='" . config('admin.route.prefix') . "';");
Admin::style(
    <<<STYLE
       .box>.box-body>table>thead>tr>th{
    min-width: 4em;
}
@media screen and (max-width: 1600px){
    .box>.box-body{
        overflow-x: scroll;
        overflow-y: hidden;
        white-space: nowrap;
    }
    .box>.box-body>table>thead>tr>th{
        min-width: 6em;
        max-width: 12em;
        white-space: pre-wrap;
    }
    .box>.box-body>table>tbody>tr>td{
        min-width: 6em;
    }
}
STYLE
);
